<!DOCTYPE html>
<html>

<head>

    {include file="Public/header"}
    <link href="__STATIC__/layout/css/gyq.css" rel="stylesheet">
    <link rel="stylesheet" href="__STATIC__/layout/css/demo.css" type="text/css">
     <script src="__STATIC__/layout/js/jquery.min.js?v=2.1.4"></script>
    <script src="__STATIC__/sc/js/page.js"></script>
</head>

<body style="color:#333;">
<!-- 标题 -->
<div class="page-heade">
    <h2 class="clearfix text-center">
        <a class="col-md-3 title_color H_right" id="Ap1" style="color:#333; font-size: 16px"
           href="{:url('ti_apply/index')}">常规促销费用申请</a>
        <a class="col-md-3 title_color H_right" id="Ap2" style="color:#333;font-size: 16px" href="{:url('ti_apply2/index')}">非常规促销费用申请</a>
        <a class="col-md-3 title_color H_right H_active" id="Ap3" style="font-size: 16px" href="{:url('tijinchang/index')}">进场费用申请</a>
        <a class="col-md-3 title_color" id="Ap4" style="color:#333;font-size: 16px" href="{:url('other/zxfeiyongapply')}">专项费用申请</a>
    </h2>
</div>
<!-- 标题 -->
<div class="form-inline">
   <form action="#" method="post" id="form_check" class="formpage">
     <input type="hidden" value='{$page}' name="page" id="page-go"/>
                      <input type="hidden" value='{$list}' name="list" id="list-go"/>
        <table class="row-margin-top tab-content table-bordered table text-center" border="1">
            <tr>
                <td class="text-left" colspan="8" rowspan=""><a href="{:url('add')}" class="btn btn-primary">新增进场申请</a>
                </td>
            </tr>
           <tr>
                <td><label for="" class="form-label">编号：</label><input type="text" class="form-control" name="no" value="{$data.no}"></td>
                <td><label for="">主题：</label><input type="text" class="form-control" name="title" value="{$data.title}"></td>
                <td><label for="">状态：</label>
                    <select name="status" id="state" class="form-control select" style="min-width: 100px;width: 100px">
                        <option value="0">请选择</option>
                         <option value="1" {if isset($data.status)&&$data.status==1}selected{/if}>草稿</option>
                        <option value="2" {if isset($data.status)&&$data.status==2}selected{/if}>已打回</option>
                        <option value="3" {if isset($data.status)&&$data.status==3}selected{/if}>区域领导审批</option>
                        <option value="4" {if isset($data.status)&&$data.status==4}selected{/if}>拆分人审批</option>
                        <option value="5" {if isset($data.status)&&$data.status==5}selected{/if}>集团领导审批</option>
                        <option value="6" {if isset($data.status)&&$data.status==6}selected{/if}>抄送</option>
                        <option value="7" {if isset($data.status)&&$data.status==7}selected{/if}>已归档</option>
                        <option value="8" {if isset($data.status)&&$data.status==8}selected{/if}>已作废</option>
                        <option value="9" {if isset($data.status)&&$data.status==9}selected{/if}>已否决</option>
                    </select></td>
                <td>
                    <div class="form-group">
                        申请时间
                    </div>
                    <div class="form-group">
                        <input type="text" id="start" placeholder="开始日期" class="form-control layer-date "
                               style="min-width:100px;height: 26px;display: inline-block;" name="start" value="{$data.start}">
                    </div>
                    <div class="form-group">
                        至
                    </div>
                    <div class="form-group">
                        <input type="text" class="form-control layer-date" placeholder="结束日期"
                               style="min-width:100px;height: 26px;display: inline-block;" id="end" name="end" value="{$data.end}">
                    </div>
                </td>
                <td>
                    <button class="btn btn-info btn-sm query" type="button" id="check">查询</button>
                    <button class="btn btn-info btn-sm emptyIf" type="button" id="clear_check">清空查询条件</button>
                </td>
            </tr>
        </table>

        <table class="table table-striped table-bordered table-hover bud_hei text-center">
            <tr class="info text-center">
                <th class="text-center">NO.</th>
                <th class="text-center">类型</th>
                <th class="text-center">编号</th>
                <th class="text-center">主题</th>
                <th class="text-center">状态</th>
                <th class="text-center">申请人</th>
                <th class="text-center">申请时间</th>
                <th class="text-center">操作</th>
            </tr>
            {volist name="applys" id="row"}
            <tr>
                <td>{$row.id}</td>
                <td>进场费用{$row.cate_title}</td>
                <td>
                    <a href="{:url('view',['id'=>$row.id])}" class="view1 J_menuItem" title="{$row.sn}">{$row.sn}</a>
                </td>
                <td>
                    {if $row.status==7}

                    {if $row.status2==2}
                    <del class="delCssQ">
                        <span>{$row.title}</span>
                        <span class="glyphicon glyphicon-remove yidong" title="已取消" aria-hidden="true"></span>
                    </del>
                    {else}
                    {$row.title}
                    <span class="glyphicon glyphicon-ok duigou" title="已生效" aria-hidden="true"></span>
                    {if $row.fb==1}
                    <span class="glyphicon glyphicon-send fankui" title="已反馈" aria-hidden="true"></span>
                    {/if}
                    {/if}
                    {else}
                    {$row.title}
                    {/if}
                    {if $row.yhx}
                    <span class="glyphicon glyphicon-yen yen" title="已核销" aria-hidden="true"></span>
                    {/if}
                    <!--<span class="glyphicon glyphicon-remove yidong " title="已异动" aria-hidden="true"></span>-->
                </td>
                <td>{$row.status_title}</td>
                <td>{$row.cusername}</td>
                <td>{$row.ctime}</td>
                <td>
                    {if $row.status==7}
                        {if $row.status2!=2}
                            {if $row.fb==0&&!$row.yhx&&!$row.zzhx}
                            <a href="{:url('cancel',['id'=>$row.id])}" >取消</a>
                            {/if}
                            <a href="{:url('TiApply/hexiao',['aid'=>$row.id])}" class="J_menuItem">核销</a>
                        {/if}
                    {else}
                        {if $row.status==0}
                            <a href="javascript:;" data-link="{:url('subworkflow',['id'=>$row.id])}" class="subworkflownew">提交工作流</a>
                            <a href="{:url('update',['id'=>$row.id])}">修改</a>
                            <a href="{:url('delete',['id'=>$row.id])}" class="delete">删除</a>
                        {elseif $row.status==2}
                          <a href="{:url('update',['id'=>$row.id])}">修改/作废</a>
                        {/if}
                    {/if}
                    <a href="{:url('workflowchart',['id'=>$row.id])}"  class="J_menuItem">流程图</a>
                </td>
            </tr>
            {/volist}
        </table>
        <h5 class="text-center" id="pagesc" style="font-size: 16px;font-weight: 500">
            <script>
                            $(function(){
                                pageSC("pagesc",{$sum},{$page},{$maxpage})
                            })
                        </script> 
                 每页显示
           <select id="pagesize">
                        <option value='20' {if condition="$list eq 20"}selected{/if}>20条</option>
                        <option value='40'{if condition="$list eq 40"}selected{/if}>40条</option>
                        <option value='50'{if condition="$list eq 50"}selected{/if}>50条</option>

            </select>
        </h5>
    </form>
</div>
<!-- 全局js -->
{include file="Public/footer"}
<!-- <script src="js/plugins/metisMenu/jquery.metisMenu.js"></script> -->
<script src="__STATIC__/layout/js/plugins/slimscroll/jquery.slimscroll.min.js"></script>
<!--统计代码，可删除-->
<script src="__STATIC__/layout/js/plugins/layer/laydate/laydate.js"></script>
<script src="__STATIC__/layout/js/tijinchang/index.js"></script>
</body>
<script src="__STATIC__/layout/js/contabs_sub.js"></script>
<script type="text/javascript">

        $("#check").click(function(){
              
             $(".formpage").submit();
        })
        $("#clear_check").click(function(){
            $("input[type='text']").val("");
            $("#state").val(0);
             $(".formpage").submit();
        })
        //日期范围限制
    var start = {
        elem: '#start',
        format: 'YYYY/MM/DD',
      
        max: '2099-06-16 23:59:59', //最大日期
        istime: true,
        istoday: false,
        choose: function (datas) {
            end.min = datas; //开始日选好后，重置结束日的最小日期
            end.start = datas //将结束日的初始值设定为开始日
        }
    };
    var end = {
        elem: '#end',
        format: 'YYYY/MM/DD',
      
        max: '2099-06-16 23:59:59',
        istime: true,
        istoday: false,
        choose: function (datas) {
            start.max = datas; //结束日选好后，重置开始日的最大日期
        }
    };
    laydate(start);
    laydate(end);
//提交工作流
$('.subworkflownew').click(function () {
    var link = $(this).data('link')
    swal({
        title: "您确定提交工作流吗",
        text: "",
        type: "warning",
        showCancelButton: true,
        confirmButtonColor: "#DD6B55",
        confirmButtonText: "确定",
        closeOnConfirm: false
    }, function (isConfirm) {
        if(isConfirm){
            $.ajax({
                'type':'post',
                'url':link,
                'dataType':'json',
                'success':function (data) {
                    if(data.success){
                        swal({
                            title:data.msg,
                            type:'success'
                        },function () {
                            location.reload()
                        })
                    }else
                        swal(data.msg, "", "error");
                }
            })
        }

    });
    return false
});
</script>
<script>
    $('.J_menuItem').on('click', menuItem);
</script>
</html>
